package com.hfy.kandian.controller;


import com.hfy.kandian.mapper.VipMapper;
import com.hfy.kandian.service.VipService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.security.PermitAll;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author HAN XIAOYANG
 * @since 2020-12-30
 */
@RestController
@RequestMapping("/vip")
public class VipController {
    @Autowired
    private VipService vipService;


    @ApiOperation(value = "判断是否为VIP:0不是VIP，1已过期，2是VIP")
    @GetMapping("/isVip/{userId}")
    public int isVip(@PathVariable int userId){
        return vipService.isVip(userId);
    }


    @ApiOperation(value = "成为Vip,传入时长以月为单位")
    @GetMapping("/beVip/{userId}/{dateLen}")
    public int beVip(@PathVariable int userId, @PathVariable int dateLen) {
        return vipService.beVip(userId, dateLen);
    }
}

